<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head th:replace="admin/fragments/head">
<title>用户管理</title>
</head>
<body class="hold-transition skin-blue sidebar-mini">
	<div class="wrapper">

		<div th:replace="admin/fragments/header"></div>
		<div th:replace="admin/fragments/mainsidebar::mainside('用户管理','user')"></div>

		<div class="content-wrapper">
			<section class="content-header">
				<h1>
					用户管理 
				</h1>
			</section>

			<section class="content container-fluid">
				<div class="box box-primary">
					<div class="box-header">
						<a class="btn btn-sm btn-success" href="/admin/user/add">新增</a>
					</div>
					<div class="box-body">
						<table id="userTab" class="table table-bordered table-striped">
							<thead>
								<tr>
									<th>用户名</th>
									<th>性别</th>
									<th>操作</th>
								</tr>
							</thead>
						</table>
					</div>
				</div>
			</section>
		</div>

		<div th:replace="admin/fragments/footer"></div>
	</div>

	<div th:replace="admin/fragments/script"></div>
	<script>
		$(document)
				.ready(
						function() {
							$('#userTab')
									.DataTable(
											{
												language : {
													url : '/assets/plugins/datatables.net/Chinese.json'
												},
												"processing" : true,
												"serverSide" : false,
												"ajax" : {
													"url" : "/admin/user/find",
													"type" : "POST"
												},
												"columns" : [ {
													"data" : "userName"
												}, {
													"data" : "sex"
												}, {
													data : null
												} ],
												
												columnDefs : [ {
													render : function(data,
															type, row) {
														return '<a class="btn btn-sm btn-success" href="/admin/user/edit/'+row.id+'">修改</a> <a class="btn btn-sm btn-warning" href="/admin/user/grant/'+row.id+'">分配角色</a> <a class="btn btn-sm btn-success" href="/admin/user/del">删除</a>';
													},
													"targets" : -1
												}

												]
											});
						});
	</script>
</body>
</html>